import { useContext } from "react";
import { CounterContext } from "./indexFather";
// function IndexBrother({state,dispatch}) {
function IndexBrother(){
  console.log("IndexBrother");
  const { state, dispatch } = useContext(CounterContext);
  return (
    <div>
      <h1>Count: {state.count}</h1>
      <button onClick={() => dispatch({ type: "increment" })}>Increment</button>
      <button onClick={() => dispatch({ type: "decrement" })}>Decrement</button>
      <button onClick={() => dispatch({ type: "reset" })}>Reset</button>
    </div>
  );
}

export default IndexBrother;
